package service;

import bean.getUserInfo.UserInfo;
import common.pojo.Page;
import dao.WxUserInfoDao;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.WxUserInfo;
import pojo.form.WxUserInfoAddForm;
import pojo.form.WxUserInfoQueryForm;



/**
 * Created by asus on 2018/10/19.
 */
@Service
public class WxUserInfoService {

    @Autowired
    WxUserInfoDao wxUserInfoDao;


    /**
     * 插入用户信息，存在则更新updateTime，不存在则插入
     *
     * @param
     * @return
     */
    public int addWxUserInfo(UserInfo info) {
      return wxUserInfoDao.addWxUserInfo(info);
    }

    public WxUserInfo getWxUserInfo(WxUserInfoQueryForm queryForm) {
        return wxUserInfoDao.getWxUserInfo(queryForm);
    }

    public WxUserInfo getWxUserInfo(String openId){
        return wxUserInfoDao.getWxUserInfo(openId);
    }
    public WxUserInfo getWxUserInfo(Long  id){
        return wxUserInfoDao.getWxUserInfo(id);
    }
    public int updateWxUserInfo(String openId){
        return wxUserInfoDao.updateWxUserInfo(openId);
    }

    public int editWxUserInfo(String openId,Long deptId,Long agentId){
        return wxUserInfoDao.editWxUserInfo(openId,deptId,agentId);
    }
    public int editWxUserInfo(String openId,String parentOpenId){
        return wxUserInfoDao.editWxUserInfo(openId,parentOpenId);
    }
    public int editWxUserInfo(String openId,Long agentId){
        return wxUserInfoDao.editWxUserInfo(openId,agentId);
    }

    public int editWxUserInfoDeptId(String openId,Long deptId){
        return wxUserInfoDao.editWxUserInfoDeptId(openId,deptId);
    }
    public Page<WxUserInfo> getWxUserInfo(WxUserInfoQueryForm queryForm, int curPage, int pageSize){
        return wxUserInfoDao.getWxUserInfo(queryForm,curPage,pageSize);
    }

    public int updatePhone(String phoneNumber,String openId){
        return wxUserInfoDao.updatePhone(phoneNumber,openId);
    }
    public int updateRecommendOpenId(String recommendOpenId,String openId){
        return wxUserInfoDao.updateRecommendOpenId(recommendOpenId,openId);
    }

    public int updateQrcode(String qrCode,String openId){
        return wxUserInfoDao.updateQrcode(qrCode,openId);
    }
    public int updateMineQrcode(String mineQrCode,String openId){
        return wxUserInfoDao.updateMineQrcode(mineQrCode,openId);
    }

    public int delete(){
        return wxUserInfoDao.delete();
    }
}
